package com.mezz.bones.bff.app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

/**
 * @Author: zhuang
 * @Date: 2024/7/12 17:13
 * @Description: TODO
 * @Version: 1.0
 **/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@ComponentScan(value = {"com.mezz.bones"})
public class AppApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(AppApplication.class, args);
        Environment env = context.getEnvironment();

        // 获取当前激活的环境变量
        String activeProfiles = String.join(", ", env.getActiveProfiles());

        System.out.println("\n" +
                "██████╗  ██████╗ ███╗   ██╗███████╗███████╗       █████╗ ██████╗ ██████╗\n" +
                "██╔══██╗██╔═══██╗████╗  ██║██╔════╝██╔════╝      ██╔══██╗██╔══██╗██╔══██╗\n" +
                "██████╔╝██║   ██║██╔██╗ ██║█████╗  ███████╗█████╗███████║██████╔╝██████╔╝\n" +
                "██╔══██╗██║   ██║██║╚██╗██║██╔══╝  ╚════██║╚════╝██╔══██║██╔═══╝ ██╔═══╝\n" +
                "██████╔╝╚██████╔╝██║ ╚████║███████╗███████║      ██║  ██║██║     ██║\n" +
                "╚═════╝  ╚═════╝ ╚═╝  ╚═══╝╚══════╝╚══════╝      ╚═╝  ╚═╝╚═╝     ╚═╝\n" +
                "\n");

        System.out.println("当前激活的环境: " + (activeProfiles.isEmpty() ? "default" : activeProfiles));
    }
}
